package com.neusoft.chess;

import java.awt.*;
import java.util.Map;

/**
 * @Author: duan
 * @Date: Create in 10:26 2020/9/28
 */
public class BingChess extends Chess {

    public BingChess(int px, int player) {
        super("bing", new Point(px, 4), player);
    }

    @Override
    public boolean isAbleMove(Point t, Map<Point, Chess> map) {
        /*
            如果没有过河，只能前进
            过了河，可以左右走也可以前进
            一次走一步，不能后退
         */
        if (isBack(t) || isLine(t) < 3 || getStepCount(t) != 1) {
            return false;
        }

        return isForward(t) || (isOverRiver(getP()) && isLine(t) == 3);
    }
}
